package com.miniapp.mapper;

import com.miniapp.entity.MiniUserTemplateInfoEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 用户模版详细信息表
 * 
 * @author linyuchi
 * @email xunli-03@163.com
 * @date 2018-05-20 15:55:39
 */
public interface MiniUserTemplateInfoMapper extends SuperMapper<MiniUserTemplateInfoEntity> {

    @Select("select id,user_tmp_id as userTmpId,name,title,home from Mini_User_Template_Info b where b.user_tmp_id = #{id}")
    List<MiniUserTemplateInfoEntity> findByUserTmpIdNoTmpData(Long id);

    @Delete("delete from mini_user_template_info where user_tmp_id = #{tmpId}")
    int deleteByTmpId(Long tmpId);

    @Update("update mini_user_template_info set home = 0 where user_tmp_id = #{tmpId}")
    void updateInfoHome(Long tmpId);


//    @Query(value = "select id,userTmpId,name,title,home from MiniUserTemplateInfo b where b.userTmpId = ?1")
//    List<MiniUserTemplateInfo> findByUserTmpIdNoTmpData(Long id);

//    List<MiniUserTemplateInfoEntity> findByUserTmpId(Long id);
//
//    MiniUserTemplateInfoEntity findByUserTmpIdAndHome(Long tmpId, boolean isHome);
//    @Modifying
//    @Transactional
//    @Query(value = "delete from MiniUserTemplateInfoEntity t where t.userTmpId=?1")
//    void deleteByTmpId(Long id);
}
